subroutine r1ai_t2eamn_imnie(r1, t2, iijka,& 
               icore, fact)
!
use mod_size
use mod_ioff
use mod_orbit
use mod_iop 
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: r1(*)
real*4, intent(in) :: iijka(*)
!
real*4, intent(inout) :: t2(*), icore(*)
!
integer :: i, j, a, b, nsize
integer :: i0, i1, i2, i3
integer, external :: idsymsoc
real*8, external :: dnrm2
!this is to do r1(ai) = r1(ai) +0.5*t2(ea,mn)*<mn||ie>
i0 = 1
i1 = i0 + nvvoo*isd
i2 = i1 + nvvoo*isd
!====RAA
!t2(EA,MN)*<MN||IE>
call itranspso(t2(ioi3(1)), icore(i1), vrta, vrta, 0, popa, popa, 0, 1)
call iexpso(icore(i1), icore(i0), popa, popa, 0, 0, vrta, vrta, 0, 1, 1)
call isymtrso(iijka(ioi2(1)), icore(i1), popa, popa, 0, 0, popa, vrta, 1, 1, 1)
!
call VpqrmVpqrn_to_Vmn(icore(i0), icore(i1), 1, 1, popa, popa, 0, &
               vrta,vrta, popa, r1(ifvo(1)), 1, fact*2.d0) 
!call printdnrm2('r1', r1, 22)
!t2(eA,mN)*<mN||Ie> = -t2(Ae,Nm)*<Nm|Ie>
call itranspso(t2(ioi3(2)), icore(i1), vrta, vrtb, 1, popa, popb, 1, 1)
call isymtrso(icore(i1), icore(i0), popa, popb, 1, 0, vrta, vrtb, 1, 1, 1)
call isymtrso(iijka(ioi2(2)), icore(i1), popa, popb, 1, 0, popa, vrtb, 1, 1, 1)
call VpqrmVpqrn_to_Vmn(icore(i0), icore(i1), 1, 1, popa, popb, 1, &
               vrtb,vrta, popa, r1(ifvo(1)), 1, -fact*2.d0) 
!call printdnrm2('iijka', iijka, 2)
!call printdnrm2('r1', r1, 22)
!====RBB
!t2(ea,mn)*<mn||ie>
call itranspso(t2(ioi3(3)), icore(i1), vrtb, vrtb, 0, popb, popb, 0, 1)
call iexpso(icore(i1), icore(i0), popb, popb, 0, 0, vrtb, vrtb, 0, 1, 1)
call isymtrso(iijka(ioi2(3)), icore(i1), popb, popb, 0, 0, popb, vrtb, 1, 1, 1)
!
call VpqrmVpqrn_to_Vmn(icore(i0), icore(i1), 1, 1, popb, popb, 0, &
               vrtb,vrtb, popb, r1(ifvo(2)), 1, fact*2.d0) 
!t2(Ea,Mn)*<Mn||iE> = t2(Ea,Mn)*<nM|iE>
call itranspso(t2(ioi3(2)), icore(i0), vrta, vrtb, 1, popa, popb, 1, 1)
call isymtrso(iijka(ioi2(4)), icore(i2), popb, popa, 1, 0, popb, vrta, 1, 1, 1)
call isymtrso(icore(i2), icore(i1), popb, popa, 1, 1, vrta, popb, 1, 0, 1)
call VpqrmVpqrn_to_Vmn(icore(i0), icore(i1), 1, 1, popb, popa, 1, &
               vrta,vrtb, popb, r1(ifvo(2)), 1, -fact*2.d0) 


return
end
